/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.notice.view;

import android.content.Context;
import android.text.TextUtils.TruncateAt;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ScrollView;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.common.d.a.a;
import com.qihoo.gamecenter.sdk.common.i.s;

public class NoticeView extends LinearLayout {
    private Context a;
    private Button b;
    private TextView c;
    private TextView d;
    private ScrollView e;
    private LinearLayout f;
    private com.qihoo.gamecenter.sdk.support.d.a g;
    private a h;
    private b i = new b(null);

    public NoticeView(Context paramContext) {
        super(paramContext);
        this.a = paramContext;
        this.g = com.qihoo.gamecenter.sdk.support.d.a.a(paramContext);
        a();
    }

    private void a() {
        setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        setOrientation(1);
        setBackgroundColor(-1610612736);
        setGravity(17);
        setVisibility(8);
        setOnClickListener(this.i);
        this.f = new LinearLayout(this.a);
        this.f.setLayoutParams(new LinearLayout.LayoutParams(s.b(this.a, 310.0F), s.b(this.a, 260.0F)));
        this.f.setOrientation(1);
        this.f.setClickable(true);
        this.g.a(this.f, -1073741784);
        this.f.addView(b());
        this.f.addView(c());
        addView(this.f);
    }

    private View b() {
        LinearLayout localLinearLayout = new LinearLayout(this.a);
        localLinearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, s.b(this.a, 36.0F)));
        localLinearLayout.setGravity(16);
        this.g.a(localLinearLayout, -1073741783);
        localLinearLayout.setPadding(s.b(this.a, 15.0F), 0, s.b(this.a, 15.0F), 0);
        localLinearLayout.setOrientation(0);
        this.d = new TextView(this.a);
        this.d.setSingleLine();
        this.d.setEllipsize(TextUtils.TruncateAt.MIDDLE);
        this.d.setLayoutParams(new LinearLayout.LayoutParams(-2, -1));
        this.d.setTextSize(1, s.a(this.a, 16.0F));
        this.d.setTextColor(-1348087);
        this.d.setGravity(17);
        localLinearLayout.addView(this.d);
        return localLinearLayout;
    }

    private View c() {
        int j = s.b(this.a, 18.0F);
        LinearLayout localLinearLayout = new LinearLayout(this.a);
        localLinearLayout.setLayoutParams(new LinearLayout.LayoutParams(-1, 0, 1.0F));
        localLinearLayout.setOrientation(1);
        localLinearLayout.setPadding(j, s.b(this.a, 11.0F), j, s.b(this.a, 3.0F));
        LinearLayout.LayoutParams localLayoutParams1 = new LinearLayout.LayoutParams(-1, 0, 1.0F);
        localLayoutParams1.bottomMargin = s.b(this.a, 7.0F);
        this.e = new ScrollView(this.a);
        this.e.setLayoutParams(localLayoutParams1);
        localLinearLayout.addView(this.e);
        this.c = new TextView(this.a);
        this.c.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
        this.c.setText(com.qihoo.gamecenter.sdk.common.d.a.a(a.a.p));
        this.c.setTextSize(1, s.a(this.a, 13.3F));
        this.c.setTextColor(-11842745);
        this.c.setLineSpacing(3.4F, 1.2F);
        this.c.setGravity(17);
        this.e.addView(this.c);
        LinearLayout.LayoutParams localLayoutParams2 = new LinearLayout.LayoutParams(s.b(this.a, 200.0F), s.b(this.a,
                40.0F));
        localLayoutParams2.topMargin = s.b(this.a, 7.0F);
        localLayoutParams2.bottomMargin = s.b(this.a, 15.0F);
        localLayoutParams2.gravity = 17;
        this.b = new Button(this.a);
        this.b.setLayoutParams(localLayoutParams2);
        this.b.setGravity(17);
        this.b.setTextColor(-8031128);
        this.b.setTextSize(1, s.a(this.a, 14.7F));
        this.b.setText(com.qihoo.gamecenter.sdk.common.d.a.a(a.a.c));
        this.b.setOnClickListener(this.i);
        this.g.a(this.b, -1073741789, -1073741787, -1073741787);
        localLinearLayout.addView(this.b);
        return localLinearLayout;
    }

    private void d() {
        setVisibility(8);
    }

    private void b(String paramString1, String paramString2) {
        this.d.setText(paramString1);
        this.c.setText(paramString2);
        setVisibility(0);
    }

    public void setNoticeParams(int paramInt1, int paramInt2) {
        this.f.setLayoutParams(new LinearLayout.LayoutParams(paramInt1, paramInt2));
    }

    public void setNoticeGravity(int paramInt) {
        this.c.setGravity(paramInt);
    }

    public void a(String paramString1, String paramString2) {
        this.b.setVisibility(0);
        b(paramString1, paramString2);
    }

    public void setNoticeClosedListener(a parama) {
        this.h = parama;
    }

    public static abstract interface a {
        public abstract void a();
    }

    private class b implements View.OnClickListener {
        public void onClick(View paramView) {
            NoticeView.a(NoticeView.this);
            if (NoticeView.b(NoticeView.this) == null)
                return;
            NoticeView.b(NoticeView.this).a();
        }
    }
}